#ifndef _CURLPLUS_H__
#define _CURLPLUS_H__ 
#include <memory>
#include <string> 

#include "../../../ThirdParty/libcurl/include/curl/curl.h"

using namespace::std; 

class Curlplus
{
public:
    static  Curlplus& get_instance();
    string post(const string& url,const string& content) const;
    string get(const string& url) const;
protected:
    Curlplus(void);
    ~Curlplus(void);
    Curlplus(const Curlplus&);
    Curlplus& operator=(const Curlplus&);
    static int writer(char *data, size_t size, size_t nmemb,std::string *writerData);
private:
    static auto_ptr<Curlplus> _instance;
    inline void _setCurlopt(CURL *curl,const string& url) const;
    // default timeout 300s
    static const int s_Defaulttimeout = 300;
    static string s_Buffer;
    friend class auto_ptr<Curlplus>;
};


#endif 